/*	Replication of "Mandate Complexity and UN Peacekeeping Contributions"
	Hultman, Kathman & Shannon 2025	*/


clear
use "BJPS replication data.dta"

sort mission_number ccode_contributor year

*******************************************************
*	MAIN RESULTS: figures in paper, tables in Appendix
*******************************************************

*	1. main model: interaction nondemocracy and tasks
nbreg personnel i.nondemdummy_v##c.totaltasks lngdp lnpopulation milper_contributor P5member sharedregion colonialties UCDP_contributor ///
ch7 mission_fatalities_lag counter counter2 counter3 , nolog

*	coefficient plot
estimate store model1
coefplot (model1), drop(_cons) xline(0)

*	figure interaction effect
quietly margins i.nondemdummy_v, at(c.totaltasks=(0 (1) 33))
 
marginsplot, recast(line)  title("Predictive Margins") xtitle("tasks") ytitle("Peacekeeping Contributions") plot1opts(lcolor(black)) ///
plot2opts(lcolor(gs6) lpattern("--"))  legend(position(6))


*	2. main model, given any PK contributions
nbreg personnel i.nondemdummy_v##c.totaltasks lngdp lnpopulation milper_contributor P5member sharedregion colonialties UCDP_contributor ///
ch7 mission_fatalities_lag  counter counter2 counter3 if anycontribution==1, nolog

*	figure interaction effect
quietly margins i.nondemdummy_v, at(c.totaltasks=(0 (1) 33))
 
marginsplot, recast(line)  title("Predictive Margins") xtitle("tasks") ytitle("Peacekeeping Contributions") plot1opts(lcolor(black)) ///
plot2opts(lcolor(gs6) lpattern("--")) legend(position(6))


*******************************************************
*	APPENDIX: Robustness tests
*******************************************************

* 	A2. TIME ISSUES

*	year-fixed effects
xtnbreg personnel i.nondemdummy_v##c.totaltasks lngdp lnpopulation milper_contributor P5member sharedregion colonialties UCDP_contributor ///
ch7 mission_fatalities_lag  counter counter2 counter3, fe i(year)

*	year fixed effects model, any PK  contribution
xtnbreg personnel i.nondemdummy_v##c.totaltasks lngdp lnpopulation milper_contributor P5member sharedregion colonialties UCDP_contributor ///
ch7 mission_fatalities_lag  counter counter2 counter3 if anycontribution==1, fe i(year)

*split sample by time period
nbreg personnel i.nondemdummy_v##c.totaltasks lngdp lnpopulation milper_contributor P5member sharedregion colonialties UCDP_contributor ///
ch7 mission_fatalities_lag counter counter2 counter3 if year<2000, nolog

nbreg personnel i.nondemdummy_v##c.totaltasks lngdp lnpopulation milper_contributor P5member sharedregion colonialties UCDP_contributor ///
ch7 mission_fatalities_lag counter counter2 counter3 if year>=2000, nolog


*	A3. SELECTION MODEL
heckman personnel i.nondemdummy_v##c.totaltasks lngdp lnpopulation milper_contributor P5member sharedregion colonialties UCDP_contributor ///
ch7 mission_fatalities_lag, twostep select(anycontribution =  nondemdummy_v  totaltasks lngdp lnpopulation milper_contributor P5member ///
 sharedregion colonialties UCDP_contributor ch7 mission_fatalities_lag  counter counter2 counter3) 


*	A4.  ZINB
zinb personnel i.nondemdummy_v##c.totaltasks lngdp lnpopulation milper_contributor P5member sharedregion colonialties UCDP_contributor ///
ch7 mission_fatalities_lag,  inflate(nondemdummy_v totaltasks lngdp lnpopulation milper_contributor P5member sharedregion ///
colonialties UCDP_contributor ch7 mission_fatalities_lag counter counter2 counter3) 


*	A5. ALTERNATIVE IV SPECIFICATIONS

* Polity for democracy
nbreg personnel i.nondemdummy6##c.totaltasks lngdp lnpopulation milper_contributor P5member sharedregion colonialties UCDP_contributor ///
ch7 mission_fatalities_lag counter counter2 counter3, nolog

*drop military personnel
nbreg personnel i.nondemdummy_v##c.totaltasks lngdp lnpopulation P5member sharedregion colonialties UCDP_contributor ///
ch7 mission_fatalities_lag counter counter2 counter3 , nolog

*use mission fatalities without lag
nbreg personnel i.nondemdummy_v##c.totaltasks lngdp lnpopulation milper_contributor P5member sharedregion colonialties UCDP_contributor ///
ch7 mission_fatalities counter counter2 counter3 , nolog
